from django.db import models

# Create your models here.

class Cate(models.Model):
    name = models.CharField(max_length=100)
    class Meta:
        db_table='cate'
        verbose_name='分类表'
        verbose_name_plural=verbose_name
    def __str__(self):
        return self.name

class Books(models.Model):
    name = models.CharField(max_length=100)
    price = models.DecimalField(max_digits=7,decimal_places=2)
    cate = models.ForeignKey(Cate,on_delete=models.CASCADE)
    class Meta:
        db_table='books'
        verbose_name = '图书表'
        verbose_name_plural = verbose_name
    def __str__(self):
        return self.name

